package com.itheima.mapper;

import com.itheima.dto.EmpQueryRequest;
import com.itheima.pojo.Emp;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {
    List<Emp> queryEmpPage(EmpQueryRequest empQueryRequest);

    @Options(keyProperty = "id",useGeneratedKeys = true,keyColumn = "id")
    @Insert("insert into emp values (null,#{username},#{password},#{name},#{gender},#{phone},#{job},#{salary},#{image},#{entryDate},#{deptId},#{createTime},#{updateTime})")
    void insertEmp(Emp emp);

    void deleteByIds(@Param("ids") List<Integer> ids);

    Emp getInfoById(Integer id);

    void updateById(Emp emp);

    List<Map<String,Object>> queryJobCount();

    List<Map<String,Object>> queryGenderCount();

    @Select("select * from emp")
    List<Emp> getClazz();

    @Select("select * from emp where username=#{username} and password=#{password}")
    Emp findByUserNameAndPassword(@Param("username") String username, @Param("password") String password);
}
